package com.example.spring.jpa.specification;

import java.util.*;
import javax.persistence.criteria.Predicate;

/**
 * @author: orange
 * @create: 2023-07-23 22:50
 * @description:
 */
public class StackParse {
    // 次要优先级的运算符
    private final Deque<String> minor = new ArrayDeque<>();
    // 主要优先级的运算符
    private final Deque<String> priority = new ArrayDeque<>();
    // 变量和值
    private final Deque<String> staticExpression = new ArrayDeque<>();
    // Predicate
    private final Deque<Predicate> predicate = new ArrayDeque<>();

    public boolean minorIsEmpty() {
        return minor.isEmpty();
    }
    public String minorPop() {
        return minor.pop();
    }
    public void minorPush(String minor) {
        this.minor.push(minor);
    }

    public boolean staticExpIsEmpty() {
        return staticExpression.isEmpty();
    }
    public String staticExpPop() {
        return staticExpression.pop();
    }
    public void staticExpPush(String str) {
        staticExpression.push(str);
    }

    public boolean predicateEmpty() {
        return predicate.isEmpty();
    }
    public Predicate predicatePop() {
        return predicate.pop();
    }
    public void predicatePush(Predicate predicate) {
        this.predicate.push(predicate);
    }

    public boolean priorityIsEmpty() {
        return this.priority.isEmpty();
    }
    public String priorityPop() {
        return this.priority.pop();
    }
    public void priorityPush(String push) {
        this.priority.push(push);
    }

}
